package com.wwg.base.label.lang.ref;

/**
 * @类描述: 测试若引入
 * @Author wwg
 * @date: 2021/7/15 16:21
 * @Version: 1.0
 **/
public class TestWeakReference {
    public static void main(String[] args) {
        WeakReferenceSon weakReferenceSon = new WeakReferenceSon(new Apple("红富士"));

        System.out.println(weakReferenceSon.get());
//        weakReferenceSon.clear();
        System.gc();

        if (weakReferenceSon.get() == null) {
            System.out.println("gc 已经把弱引用清除掉了！！");
        }

    }
}
